import http from '@/http'
import type {RolePram, SaveMenuParam, SysRole} from "@/api/role/RoleModel.ts";
//添加角色
export const addApi = function (pram: SysRole) {
    return http.post('api/role/add', pram)
}
//分页查询角色列表
export const getListApi = (pram: RolePram) => {
    return http.get('api/role/getList', pram)
}

export const editApi = (param: SysRole) => {
    return http.put('api/role', param)
}

export const delApi = (roleId: string) => {
    return http.delete(`api/role/${roleId}`)
}
//角色下拉
export const getSelectApi = () => {
    return http.get('api/role/selectList')
}
//查询角色是否被占用
export const isUsedApi = (roleId: string) => {
    return http.get('api/role/isUsed', {roleId: roleId})
}

//分配菜单保存
export const saveRoleMenuApi = function (pram: SaveMenuParam) {
    return http.post('api/role/saveRoleMenu', pram)
}